<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <link rel="stylesheet" type="text/css" href="http://127.0.0.1/project/hdphp_fk_cms/Static/hdjs/hdjs.css"/>
    <link rel="stylesheet" type="text/css" href="http://127.0.0.1/project/hdphp_fk_cms/Static/bootstrap/css/bootstrap.min.css" />
    <script src="http://127.0.0.1/project/hdphp_fk_cms/Static/js/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
    <title>品牌管理</title>
    <style type="text/css">
        table{
            color: #666;
        }
    </style>
    <script type="text/javascript">
            //操作图片的上传及删除
            $(function(){
                //点击x 删除图片
                $('.close').click(function(){
                    //父级td
                    var td = $(this).parents('td');
                    //获得完整路径
                    var path = $(this).attr('path');
                    //获得对应的aid
                    var aid = $(this).attr('aid');
                    $.ajax({
                        type:"post",
                        url:"<?php echo U('delImg');?>",
                        data:{path : path,aid : aid},
                        success:function(){
                            //让图片隐藏
                            td.find('img').hide();
                            //组合input字符串
                            var str = '<input type="file" name="thumb" id="" />';
                            //给td插入input
                            td.html(str);
                        }
                    });
                    
                })
            })
    </script>
</head>
<body>
<div class="wrap">
    <div class="hd-title-header"><h4 style="color:blue">添加品牌</h4></div>
    <form action="" method="post" class="form-inline hd-form" enctype="multipart/form-data">
        <table class="hd-table hd-table-form hd-form">
            <tr>
                <th><label for="exampleInputName2"><h4 style="color:blue">品牌名称</h4></label></th>
                <td width="400">
                    <input type="text" name="bname" class="form-control" id="exampleInputName2" value="<?php echo $oldData['bname'];?>">         
                </td>
                <td>注：填入品牌名称,每次只允许填入一个品牌</td>
            </tr>
            <tr>
                <th class="w100"><label for="exampleInputName2"><h4 style="color:blue">品牌排序</h4></label></th>
                <td>
                    <input type="text" name="sort" class="w200" value="<?php echo $oldData['sort'];?>"/>
                </td>
                <td>请填写1到255的排序数字,默认为100 </td>
            </tr>
            <tr>
                <th class="w100"><label for="exampleInputName2"><h4 style="color:blue">LOGO</h4></label></th>
                <td>
                        <?php if($oldData['logo']){ ?>
                              <!--显示缩略图，注意http://127.0.0.1/project/hdphp_fk_cms的用法-->
                              <img src="http://127.0.0.1/project/hdphp_fk_cms/<?php echo $oldData['logo'];?>" style="width:80px;";/>   
                              <!--X号代表删除图片，注意path和aid的传输及用法，配合上面的异步使用；-->
                              <a href="javascript:;" style="color: red;" class="close" path="<?php echo $oldData['thumb'];?>" aid="<?php echo $oldData['aid'];?>">X</a>
                          <?php }else{ ?>
                              <input type="file" name="logo" id="" /> 
                    <?php } ?>
                </td>
                <td></td>
            </tr>
            <tr>
                <th class="w100"><label for="exampleInputName2"><h4 style="color:blue">是否热门</h4></label></th>
                <td>
                                                       是:<input type="radio" name="is_hot" id=""     <?php if($oldData[is_hot]==1){ ?>checked="checked"<?php } ?> value="1"/>&nbsp;
                                                       否:<input type="radio" name="is_hot" id=""     <?php if($oldData[is_hot]==0){ ?>checked="checked"<?php } ?> value="0"/>
                </td>
            </tr> 
             <tr>
                <th class="w100"><label for="exampleInputName2"><h4 style="color:blue">是否显示</h4></label></th>
                <td>
                                                       否:<input type="radio" name="is_lock" id=""     <?php if($oldData[is_lock]==1){ ?>checked="checked"<?php } ?> value="1"/>&nbsp;
                    是:<input type="radio" name="is_lock" id=""     <?php if($oldData[is_lock]==0){ ?>checked="checked"<?php } ?> value="0"/>
                </td>
            </tr> 
        </table>
         <input type="submit" class="hd-btn hd-btn-success hd-btn-lg" value="修改" style="margin-top:20px;margin-left:20px;"/>
    </form>
</div>
</body>
</html>